<template>
  <!-- 首页banner -->
  <div :id="$store.state.oldPage?'homeBanner_old': 'homeBanner'">
    <div class="top flex-center flex-column">
      <!-- <div class="title">统战民营经济</div> -->
      <div class="title">平商有“礼”</div>
      <div class="title">教育引领服务平台</div>
      <!-- 企业版显示 -->
      <div v-if="$store.state.userList.role !='B'">
        <div v-if=" $store.state.oldPage" style="font-size:0.5rem;margin-top:0.2rem">(长辈版)</div>
        <!-- <div class="ptzz" @click="$router.push('/personalCenter/platformGeneralRules')">平台总则</div> -->
        <img class="icon4" @click="$router.push('/personalCenter/index')" src="@/assets/images/grzx.png" />
      </div>
      <!-- 企业版显示 end -->
      <!-- 金融服务合作商端 -->
      <div v-else>
        <div class="flex-row">
          <img class="exit" @click="exit" src="@/assets/images/zx.png" />
        </div>
      </div>
      <!-- 金融服务合作商端 end-->
      <!-- 切换长辈版 常规版按钮 -->
      <!-- <van-button type="default" class="icon5" @click="$store.commit('SET_oldPage',!$store.state.oldPage)">切换{{!$store.state.oldPage?'长辈版':'常规版'}}</van-button> -->
      <!-- 切换长辈版 常规版按钮 end -->
      <!-- 常规版 -->
      <div v-if=" !$store.state.oldPage" style="margin-top: 0.53rem;width:100%">
        <!-- 企业端 -->

        <div v-if="$store.state.userList && $store.state.userList.company">
          <div class="flex-between flex-alignCenter">
            <div class="title2">{{ $store.state.userList.company.name }}</div>
            <div v-if="$store.state.userList && $store.state.userList.role == 'C'" class="flex-row flex-alignCenter">
              <!-- 商标服务商 -->
              <!-- 未认证 -->
              <img class="icon1" v-if="userList.company.trademarkState == 'NONE'"
                src="@/assets/images/nonPublicEconomy/rz1.png" />
              <!-- 待审核 -->
              <img class="icon1" v-if="userList.company.trademarkState == 'ING'"
                src="@/assets/images/nonPublicEconomy/rz2.png" />
              <!-- 已认证 -->
              <img class="icon1" @click="jump('商标服务商')" v-if="userList.company.trademarkState == 'PASS'"
                src="@/assets/images/nonPublicEconomy/rz3.png" />
              <!-- 未通过 -->
              <img class="icon1" v-if="userList.company.trademarkState == 'UNPASS'"
                src="@/assets/images/nonPublicEconomy/rz4.png" />
              <!-- 商标服务商 end-->
              <!-- 知识产权服务商 -->
              <!-- 未认证 -->
              <img class="icon2" v-if="userList.company.intelState == 'NONE'"
                src="@/assets/images/nonPublicEconomy/zscq1.png" />
              <!-- 待审核 -->
              <img class="icon2" v-if="userList.company.intelState == 'ING'"
                src="@/assets/images/nonPublicEconomy/zscq2.png" />
              <!-- 已认证 -->
              <img class="icon2" @click="jump('知识产权服务商')" v-if="userList.company.intelState == 'PASS'"
                src="@/assets/images/nonPublicEconomy/zscq3.png" />
              <!-- 未通过 -->
              <img class="icon2" v-if="userList.company.intelState == 'UNPASS'"
                src="@/assets/images/nonPublicEconomy/zscq4.png" />
              <!-- 知识产权服务商 end-->
              <!-- 管理咨询服务商 -->
              <!-- 未认证 -->
              <img class="icon3" v-if="userList.company.advisoryState == 'NONE'"
                src="@/assets/images/nonPublicEconomy/glzx1.png" />
              <!-- 待审核 -->
              <img class="icon3" v-if="userList.company.advisoryState == 'ING'"
                src="@/assets/images/nonPublicEconomy/glzx2.png" />
              <!-- 已认证 -->
              <img class="icon3" @click="jump('管理咨询服务商')" v-if="userList.company.advisoryState == 'PASS'"
                src="@/assets/images/nonPublicEconomy/glzx3.png" />
              <!-- 未通过 -->
              <img class="icon3" v-if="userList.company.advisoryState == 'UNPASS'"
                src="@/assets/images/nonPublicEconomy/glzx4.png" />
              <!-- 管理咨询服务商 end-->
              <!-- <div @click="$router.push('/nonPublicEconomy/becomeAServiceProvider')" style="margin-left:0.1rem">成为服务商</div> -->
              <van-button type="default" @click="$router.push('/nonPublicEconomy/becomeAServiceProvider')" style="
                border-radius: 20px;
                margin-left: 0.1rem;
                padding: 0.1rem;
                height: auto;
              ">成为服务商</van-button>
            </div>
          </div>
        </div>
        <!-- 企业端 end-->
        <!-- 金融服务合作商端 -->
        <div v-if="$store.state.userList && $store.state.userList.role =='B'" class="flex-row">
          <!-- <img style="height:0.34rem;width:0.34rem;margin-right:0.2rem" v-if="userList.bank.imgUrl" :src="userList.bank.imgUrl" /> -->
          <div class="title2" style="width:auto;max-width:70%">{{ $store.state.userList.bank.name }}</div>
          <img class="icon1" src="@/assets/images/nonPublicEconomy/rz3.png" />

        </div>
        <!-- 金融服务合作商端 end-->
      </div>
      <!-- 长辈版 -->
      <div v-if="$store.state.oldPage " style="margin-top: 0.3rem;width:100%">
        <div v-if="$store.state.userList && $store.state.userList.company">
          <div class="flex-between flex-alignCenter">
            <div class="title2">{{ $store.state.userList.company.name }}</div>
            <div class="yrz1">已认证</div>

          </div>
          <div>
            <div v-if="$store.state.userList && $store.state.userList.role == 'C'"
              class="flex-between flex-alignCenter">
              <div class="yrz2">管理咨询服务商</div>
              <div class="yrz3">知识产权服务商</div>
              <div style="font-size:0.3rem">成为服务商
                <van-icon name="arrow" />
              </div>

              <!-- <van-button type="default" @click="$router.push('/nonPublicEconomy/becomeAServiceProvider')" style="
                border-radius: 20px;
                margin-left: 0.1rem;
                padding: 0.1rem;
                height: auto;
              ">成为服务商</van-button> -->
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="banner">
      <van-swipe :autoplay="3000">
        <van-swipe-item v-for="(item, index) in bannerList" :key="index">
          <img :src="item.imgUrl" alt="" />
        </van-swipe-item>
      </van-swipe>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      bannerList: [],
      userList: [],
    };
  },
  created() {
    this.adList_index();
    this.userList = this.$store.state.userList;
  },
  methods: {
    exit() {
      this.$dialog
        .confirm({
          title: "提示",
          message: "确定退出登录吗",
        })
        .then(() => {
          window.localStorage.removeItem("userList");
          this.$router.replace({
            path: "/?role=B",
          });
        })
        .catch(() => {
          // on cancel
        });
    },
    jump(type) {
      this.$router.push({
        path: "/serviceProvider/index",
        query: { topBarName: type },
      });
    },
    adList_index() {
      var params = {};
      this.$myApi.adList_index(params).then((res) => {
        if (res.code == 200) {
          this.bannerList = res.data;
        } else {
        }
      });
    },
  },
};
</script>
<style lang="less" scoped>
#homeBanner {
  .top {
    margin-top: 00.4rem;
    .title {
      font-size: 0.36rem;
      font-family: FZDaHei-B02S;
      font-weight: 400;
      color: #111111;
      line-height: 0.48rem;
      font-weight: bold;
      text-align: center;
    }
    .title2 {
      font-size: 0.3rem;
      font-family: SimHei;
      font-weight: 400;
      color: #333333;
      width: 46%;
    }
    .icon1 {
      width: 0.91rem;
      height: 0.34rem;
      margin-left: 0.1rem;
    }
    .icon2 {
      width: 0.34rem;
      height: 0.34rem;
      margin-left: 0.1rem;
    }
    .icon3 {
      width: 0.34rem;
      height: 0.34rem;
      margin-left: 0.1rem;
    }
    .icon4 {
      width: 0.33rem;
      height: 0.36rem;
      position: absolute;
      right: 0.2rem;
      top: 0.6rem;
    }
    .exit {
      width: 0.34rem;
      height: 0.34rem;
      position: absolute;
      right: 0.2rem;
      top: 0.6rem;
    }
    .ptzz {
      position: absolute;
      right: 0.7rem;
      top: 0.6rem;
      font-weight: bold;
    }
    .icon5 {
      position: absolute;
      left: 0.2rem;
      top: 0.6rem;
      padding: 0 0.1rem;
    }
  }
  .banner {
    width: 7.1rem;
    height: 3rem;
    border-radius: 15px;
    margin: 0 auto;
    margin-top: 0.3rem;
    margin-bottom: 0.5rem;

    img {
      width: 7.1rem;
      height: 3rem;
      border-radius: 15px;
    }
  }
}
#homeBanner_old {
  .top {
    margin-top: 0.2rem;
    .yrz {
      font-size: 0.25rem;
      padding: 0.1rem 0.2rem;
      color: #fff;
      border-radius: 5px;
    }
    .yrz1 {
      .yrz();
      background: #58c68c;
    }
    .yrz2 {
      .yrz();
      background: #fa5921;
      margin-right: 0.1rem;
    }
    .yrz3 {
      .yrz();
      background: #fcc936;
    }
    .title {
      font-size: 0.5rem;
      font-family: FZDaHei-B02S;
      font-weight: 400;
      color: #111111;
      line-height: 0.8rem;
      font-weight: bold;
      text-align: center;
    }
    .title2 {
      font-size: 0.5rem;
      font-family: SimHei;
      font-weight: 400;
      color: #333333;
      margin-bottom: 0.2rem;
    }
    .icon1 {
      width: 0.91rem;
      height: 0.34rem;
      margin-left: 0.1rem;
    }
    .icon2 {
      width: 0.34rem;
      height: 0.34rem;
      margin-left: 0.1rem;
    }
    .icon3 {
      width: 0.34rem;
      height: 0.34rem;
      margin-left: 0.1rem;
    }
    .icon4 {
      width: 0.68rem;
      height: 0.79rem;
      position: absolute;
      right: 0.2rem;
      top: 0.3rem;
    }
    .ptzz {
      position: absolute;
      right: 1rem;
      top: 0.4rem;
      font-weight: bold;
    }
    .icon5 {
      position: absolute;
      left: 0.1rem;
      top: 0.1rem;
      padding: 0 0.1rem;
    }
  }
  .banner {
    width: 7.1rem;
    height: 3rem;
    border-radius: 15px;
    margin: 0 auto;
    margin-top: 0.3rem;
    margin-bottom: 0.5rem;

    img {
      width: 7.1rem;
      height: 3rem;
      border-radius: 15px;
    }
  }
}
</style>